
      
<link rel='stylesheet' href='/js/fullcalendar/fullcalendar.css' />
<link rel='stylesheet' href='/js/fullcalendar/fullcalendar.print.css'  media='print' />
<link rel='stylesheet' href='/js/fullcalendar/scheduler.min.css' />
<script src='/js/fullcalendar/lib/moment.min.js'></script>
<script src='/js/fullcalendar/fullcalendar.min.js'></script> 
<script src='/js/fullcalendar/scheduler.min.js'></script>

<script src='/js/fullcalendar/locale/zh-cn.js'></script>

<style>
body{min-width: auto;}
table,table table {width:100% !important;}
.edui-default .edui-for-fullscreen .edui-icon{display: none !important;}
.fc-license-message{display:none !important;}
.text-bold{font-weight:bold !important;}
.fc-event{border:0 none;line-height: 1.5;}
#maincontent{width:auto !important;}
.container{width:auto !important;}
.event-cate {text-align:left;}
.fc-event, .fc-event-dot {    background-color: #C8C964;}
.fc-event .fc-content {  padding: 3px 10px;}
.fc-event, .fc-event:hover, .ui-widget .fc-event {color: #333;}
tr:first-child > td > .fc-day-grid-event ,.fc-day-grid-event{margin: 0px 1px 1px;;padding:0;border-radius:0;}
.fc-ltr .fc-basic-view .fc-day-top .fc-day-number {
    width: 32px;
    height: 32px;
    line-height: 32px;
    text-align: center;
    margin: 10px;
}
table {   margin-bottom: 0px;}
th{line-height:32px;}
.fc-head .fc-day-header{padding:10px;}
.fc-unthemed td.fc-today {
    background: transparent;
}
.fc-unthemed th, .fc-unthemed td, .fc-unthemed thead, .fc-unthemed tbody, .fc-unthemed .fc-divider, .fc-unthemed .fc-row, .fc-unthemed .fc-content, .fc-unthemed .fc-popover, .fc-unthemed .fc-list-view, .fc-unthemed .fc-list-heading td {
    border-color: #eee;
}
.fc-event .fc-content {
    padding: 3px 10px;
    margin-left: 5px;
    background: rgba(255,255,255,0.6);
}
label.btn{padding:0;border:0;}
label section {
    padding: 3px 10px;
    margin-left: 5px;
    background: rgba(255,255,255,0.6);
}
.fc-nonbusiness {
    background: #f3f3f3;
}
.fc-ltr .fc-h-event.fc-not-start .fc-content {margin-left: 0px;}
.fc td.fc-today .fc-day-number{background: red;border-radius: 100%;color: #FFF;}
.modal-backdrop{z-index: 1000;}
.fc-scroller{height:auto !important;}
.fc-list-item-time {display: none;}
h1, h2, .Content-title {font-size: 16px;line-height: 32px;}
</style>

<script>
var date_obj
var current_editor = null;
$(document).ready(function() {

    // page is now ready, initialize the calendar...

    $('#calendar').fullCalendar({
        // put your options and callbacks here
        eventSources: [
	        //'/schedules.php',
	        '/schedules/events/{{$code}}.json'
	    ],
	    resources: [
{{loop $cates $cate}}
{ id: 'cate_{{$cate['UserCate']['id']}}',eventClassName:'cate_{{$cate['UserCate']['id']}}', title: '{{$cate['UserCate']['name']}}'{{if $cate['UserCate']['bgcolor']}}, eventBackgroundColor: '{{$cate['UserCate']['bgcolor']}}'{{else}}, eventBackgroundColor: '#FFF',eventTextColor:'#333'{{/if}} } ,
{{/loop}}
{ id:'cate_default',eventClassName:'cate_default', title: '默认分类'}
		],

	    
		{{if $is_mobile}}
		defaultView: 'listMonth',
		header: {
			left: 'prev,next',
			center: 'title',
	    	right: 'listMonth'
		},
		{{else}}
		header: {
			left: 'prev,next today',
			center: 'title',
			right: 'month,basicWeek,basicDay,listMonth'
		},
		{{/if}}

	    defaultDate: '{{date("Y-m-d")}}',
	    businessHours: true,
	    selectable: true,
		selectHelper: true,
		/*dayClick: function(date, jsEvent, view) {
			console.log(date);
			console.log(date.toISOString()); 
			date_obj = date;
			{{if !$open}}
			publishController.open_dialog('/schedules/add?begintime='+date.toISOString(),{
				title:'新增日程计划',
				id:'schedule-form',
				width:720,
				submitCallback:function(request){
					if (request.data.name) {
						eventData = {
							title: request.data.name,
							start: start,
							end: end
						};
						$('#calendar').fullCalendar('renderEvent', eventData, true); // stick? = true
					}
					$('#calendar').fullCalendar('unselect');
					$('#calendar').fullCalendar( 'refetchEvents' );
				}
			});		
			{{/if}}
		},*/
		select: function(start, end) {	
			{{if !$open}}
			publishController.open_dialog('/schedules/add?begintime='+start.toISOString()+'&endtime='+end.toISOString(),{
				title:'新增日程计划',
				id:'schedule-form',
				width:720,
				submitCallback:function(request){
					$('#calendar').fullCalendar('unselect');
					$('#calendar').fullCalendar( 'refetchEvents' );
				}
			});		
			{{/if}}
		},
		loading:function(isLoading,view){
			if(!isLoading) {
				$('a.fc-event').attr('target','_blank');
			}
		},
		eventClick: function(calEvent, jsEvent, view) {
			{{if !$open}}
	        publishController.open_dialog('/schedules/edit/'+calEvent.id,{
	        	title:'修改日程计划',
	        	id:'schedule-form',
	        	width:720,
	        	submitCallback:function(request){
					/*var eventData;
					if (title) {
						eventData = {
							title: title,
							start: start,
							end: end
						};
						$('#calendar').fullCalendar('renderEvent', eventData, true); // stick? = true
					}*/
					$('#calendar').fullCalendar('unselect');
					$('#calendar').fullCalendar( 'refetchEvents' );
				}
	        });	
	        {{else}}
	        
	        {{/if}}
	        // change the border color just for fun
	        //$(this).css('border-color', 'red');
	    },
	    eventMouseover:function( event, jsEvent, view ) { 
	    	$(this).popover({'title':event.title,'placement':'top','container':'body','trigger':'hover'});
	    },
		editable: {{if !$open}}true{{else}}false{{/if}},
		schedulerLicenseKey: 'CC-Attribution-NonCommercial-NoDerivatives',
		eventLimit: true
	    //,locale: 'zh-cn' //use locale-all.js
    });
    
    $('.event-cate input:checkbox').click(function(){
    	if(this.checked) {
    		$('.cate_'+$(this).data('cate')).show();
    	}
    	else{
    		$('.cate_'+$(this).data('cate')).hide();
    	}
    });
});

</script>

<script type="text/javascript" src="/js/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="//static.135editor.com/js/ueditor/ueditor.all.min.js"></script>
<script type="text/javascript" src="//static.135editor.com/open/a92d301d77.js"></script>
<link rel="stylesheet" type="text/css" href="//static.135editor.com/open/v1/96619a5672.css" />
       <div id="Schedule-mine-list">       
		
		<div class="row">
			<div class="col-md-2 col-sm-12 col-xs-12">
		{{if !$open}}
       <div class="mb10">
       	<a class="btn btn-primary btn-block" target="_blank" href="/user_cates/add?model=Schedule">新增日程分类</a>  
       	<a class="btn btn-primary btn-block" target="_blank" href="/user_cates/mine?model=Schedule">管理日程分类</a>
       </div>
       {{/if}}
       <br/>
				<label class="btn btn-default btn-sm btn-block event-cate" style="color:#333;background-color:#C8C964;">
					<section>
						<input checked="checked" data-cate="default" type="checkbox"/>默认分类
					</section>
				</label> 
		       
		       {{loop $cates $cate}}
		       	{{if !$open || $cate['UserCate']['published']}}
		       		<label class="btn btn-default btn-sm btn-block event-cate" {{if $cate['UserCate']['bgcolor']}}style="color:#333;background-color:{{$cate['UserCate']['bgcolor']}}"{{/if}}><section><input checked="checked" data-cate="{{$cate['UserCate']['id']}}" type="checkbox">{{$cate['UserCate']['name']}}</section></label> 
		       	{{/if}}
		       {{/loop}}
			</div>
			<div class="col-md-10 col-sm-12  col-xs-12">
				<div id='calendar'></div>
			</div>
		</div>
		
       
       <br/>
       
		
    	</div>
       <br/>
       